<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta name="Author" content="Jenny.Zhan">
  <title>客房订单</title>
  <link rel="stylesheet" href="<{$ipath}>app/hotel/css/base.css">
  <link rel="stylesheet" href="<{$ipath}>app/hotel/css/layout.css">
</head>
<body>
<div class="boxwrap">
	<div class="box">
		<h3 class="l-title">订房订单</h3>
		<div class="part-grey">
            <form action="?m=order&a=orderlist" method="post">
			<ul class="order-form oh">
	            <li class="w-400">
	            	<em class="l-txt">入住时间</em>
	            	<input type="text" name="in_time" class="datepicker txt w-120" value="<{if isset($pam.in_time) && $pam.in_time}><{$pam.in_time}><{/if}>" onclick="WdatePicker({startDate:'',dateFmt:'yyyy-MM-dd'})">
	            	<em class="l-txt pd-l-8">至</em>
	            	<input type="text" name="out_time" class="datepicker txt w-120" value="<{if isset($pam.out_time) && $pam.out_time}><{$pam.out_time}><{/if}>" onclick="WdatePicker({startDate:'',dateFmt:'yyyy-MM-dd'})">
	            </li>
	            <li class="w-226">
	            	<em class="l-txt">预定客户</em>
	            	<input type="text" value="<{if isset($pam.create_name) && $pam.create_name}><{$pam.create_name}><{/if}>" name="create_name" class="txt w-120">
	            </li>
	            <li class="w-180 tr">
	            	<em class="l-txt">电话</em>
	            	<input type="text" value="<{if isset($pam.create_phone) && $pam.create_phone}><{$pam.create_phone}><{/if}>" name="create_phone" class="txt w-120">
	            </li>
	            <li class="w-400">
	            	<em class="l-txt">订单编号</em>
	            	<input type="text" class="txt w-280" value="<{if isset($pam.order_sn) && $pam.order_sn}><{$pam.order_sn}><{/if}>" name="order_sn" >
	            </li>
	            <li class="w-226">
	                <em>操作状态</em>
	                <select name="status" class="txt w-120">
	                    <option value="0"<{if !isset($pam.status)}> selected="selected"<{/if}>>全部</option>
	                    <option value="1"<{if isset($pam.status) && $pam.status eq 1}> selected="selected"<{/if}>>预订</option>
	                    <option value="2"<{if isset($pam.status) && $pam.status eq 2}> selected="selected"<{/if}>>入住</option>
	                    <option value="3"<{if isset($pam.status) && $pam.status eq 3}> selected="selected"<{/if}>>取消</option>
                        <option value="4"<{if isset($pam.status) && $pam.status eq 4}> selected="selected"<{/if}>>待支付</option>
                        <option value="5"<{if isset($pam.status) && $pam.status eq 5}> selected="selected"<{/if}>>已支付</option>
                        <option value="6"<{if isset($pam.status) && $pam.status eq 6}> selected="selected"<{/if}>>部分入住</option>
                        <option value="7"<{if isset($pam.status) && $pam.status eq 7}> selected="selected"<{/if}>>完成</option>
	                </select>
	            </li>
	            <li class="w-180"><input type="submit" value="查询" class="btn-search"/></li>
	        </ul>
            </form>
		</div>
		<div class="result">
			<ul class="list-status oh">
				<li><a <{if !isset($pam.status) || (isset($pam.status) && $pam.status eq 0)}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(0)">全部订单</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 1}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(1)">预订</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 2}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(2)">已入住</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 3}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(3)">已取消</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 4}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(4)">待支付</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 5}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(5)">已支付</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 6}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(6)">部分入住</a></li>
				<li><a <{if isset($pam.status) && $pam.status eq 7}>class="cur"<{/if}> href="javascript:void(0);" onclick="sou(7)">完成</a></li>
			</ul>
			<table class="tbl-basic" width="100%">
				<thead>
					<tr>
						<th>预订单号</th>
						<th width="140">房型</th>
						<th width="100">房号</th>
						<th width="100">预订房数</th>
						<th width="100">已开房数</th>
						<th width="10%">入住时间</th>
						<th width="10%">留房时间</th>
						<th>预订客户</th>
						<th>电话</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
                <{foreach from=$res item=v key=k}>
                    <tr>
                        <td><{$v.order_sn}></td>
                        <td colspan="4">
                            <table>
                                <{foreach from=$v.info item=a key=b}>
                                <tr>
                                    <td width="140"><{$a.name}></td>
                                    <td width="100"><{$a.rhao}></td>
                                    <td width="100"><{$a.rnum}></td>
                                    <td width="100"><{$a.enter}></td>
                                </tr>
                                <{/foreach}>
                            </table>
                        </td>
                        <td><{$v.in_time}></td>
                        <td><{$v.liu_time}></td>
                        <td><{$v.create_name}></td>
                        <td><{$v.create_phone}></td>
                        <td><{$ostatus[$v.status]}></td>
                        <td><a href="?m=order&a=getInfoById&id=<{$v.id}>" class="corg">查看</a>
                            <{if $v.status == '1'}>
                            <a href="?m=order&a=setCheckIn&id=<{$v.id}>" class="corg">编辑</a>
                            <a href="javascript:void(0);" onclick="cancelorder(<{$v.id}>)" class="corg">取消订单</a>
                            <{elseif $v.status == '2'}>
                            <a href="?m=order&a=setCheckIn&id=<{$v.id}>" class="corg">编辑</a>
                            <a href="javascript:void(0);" onclick="allexit(<{$v.id}>)" class="corg">全部退房</a>
                            <{elseif $v.status == '4'}>
                            <a href="javascript:void(0);" onclick="cancelorder(<{$v.id}>)" class="corg">取消订单</a>
                            <{elseif $v.status == '5'}>
                            <a href="?m=order&a=setCheckIn&id=<{$v.id}>" class="corg">编辑</a>
                            <a href="javascript:void(0);" onclick="cancelorder(<{$v.id}>)" class="corg">取消订单</a>
                            <{elseif $v.status == '6'}>
                            <a href="?m=order&a=setCheckIn&id=<{$v.id}>" class="corg">编辑</a>
                            <{/if}>
                        </td>
                    </tr>
                    <{/foreach}>
				</tbody>
			</table>
		</div>
		<!--分页-->
		<div class="page">
			<{$pagestr}>
		</div>
	</div>
</div>
<script src="http://test.s.zhongsou.com/app/hotel/js/jquery-1.9.1.min.js"></script>
<script src='http://test.s.zhongsou.com/app/hotel/js/My97DatePicker/WdatePicker.js'></script>
<script type="text/javascript">
    function sou(type) {
        window.location.href = "?m=order&a=orderlist&status=" + type;
    }

    function allexit(order_id){
        var url = '?m=order&a=allexit&id='+order_id;
        $.get(url,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }

    function cancelorder(id){
        var url = '?m=order&a=cancelOrder&id='+id;
        $.get(url,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }
	$('.tbl-basic>tbody>tr:odd').addClass('zebra-bg')
</script>
</body>
</html>